<?php

defined('MYLITS') ? '' : exit('No direct script access allowed');

/**
 * @version     1.0.0
 * @package     mylits engine
 * @license     GNU General Public License version 3
 * @author      Arfan Fudyartanto D N <arfan@mylits.com> - http://engine.mylits.com
 */
class loginProcess extends Mylits_Process {

    function __construct() {
        parent::__construct();
    }

    public function response() {

        $username = Mylits_System::getRequest('username');
        $password = Mylits_System::getRequest('password');
        $encryptionPass = Mylits_Security::asymmetricEncrypt($password);

        $model = $this->loadModel('login');
        $user = $model->getUser($username, $encryptionPass);

        if (!empty($user)) {
            Mylits_User::changeUser($user);
        } else {
            Mylits_System::addSystemMsg('warning', 'Password or username is wrong');
        }
        #redirect to home
        Mylits_System::redirect('');
    }

}

?>
